package com.lanlian.commonlib.bean;

import com.lanlian.commonlib.BaseApplication;
import com.lanlian.commonlib.dao.DBManager;
import com.lanlian.utillib.AppUtils;
import com.lanlian.utillib.CommonUtils;
import com.lanlian.utillib.DateUtils;
import com.lanlian.utillib.MobileUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * <pre>
 *     author : huxiaobo
 *     e-mail : huxiaobo@xlanlian.com
 *     date   : 2018/8/24 16:41
 *     desc   : 基础请求对象
 *     version: 1.0
 * </pre>
 */
public class BaseRequest implements Serializable {

    private String token;
    private Long uid;
    private String sendTime;
    private Integer version;
    private String modelType;
    private String source;

    public String getSource() {
        this.source = "android";
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public Integer getVersion() {
        this.version = AppUtils.getVersionCode(BaseApplication.getInstance());
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }


    public String getModelType() {
        this.modelType = MobileUtils.getSystemModel() + "-" + MobileUtils.getSystemVersion();
        return modelType;
    }

    public void setModelType(String modelType) {
        this.modelType = modelType;
    }


    public String getToken() {
        this.token = DBManager.getInstance().getToken();
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Long getUid() {
        this.uid = DBManager.getInstance().getUserId();
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public String getSendTime() {
        this.sendTime = DateUtils.DateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
        return sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }
}
